#ifndef MYTREEVIEW_H
#define MYTREEVIEW_H

#include <QTreeView>
#include <QStandardItemModel>
#include "mytreeitemdelegate.h"
#include <QMouseEvent>
enum ItemRoles {
    IdRole = Qt::UserRole + 1
};

struct stIemData
{
    long long m_lID;
    QString   m_qsDataValue;
    QString   m_qsMessage; //展示的文本
    QString   m_qsImageUrl; //展示的图片
    QString   m_qsHilightUrl; //展示的高亮图片
};
Q_DECLARE_METATYPE(stIemData);

class MyTreeView : public QTreeView
{
    Q_OBJECT
public:
    explicit MyTreeView(QWidget *parent = nullptr);
    QStandardItem * addItem(stIemData ItemData);
    QStandardItem * addItem(QStandardItem *, stIemData ItemData);
    void setBackgroundColor(QString qsColor);
    QStandardItem * getItem(QModelIndex);
signals:
public slots:
    void slotTreeItemClick(QModelIndex);

private:
    QStandardItemModel  m_model;
    MyTreeItemDelegate* m_delegate;
    QString             m_backGroundColor;
    long long           m_nID;

};

#endif // MYTREEVIEW_H
